#include <my_header.h>

/* Usage:  */
int main(void){                                  
    char *ip = "192.168.229.128";
    char *port = "8080";

    int socket_fd = socket(AF_INET, SOCK_STREAM, 0);
    ERROR_CHECK(socket_fd, -1, "socket");

    struct sockaddr_in sockaddr;
    sockaddr.sin_family = AF_INET;
    sockaddr.sin_port = htons(atoi(port));
    sockaddr.sin_addr.s_addr = inet_addr(ip);

    int res_conn = connect(socket_fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
    ERROR_CHECK(res_conn, -1, "connect");

    char buf[60] = { 0 };
    recv(socket_fd, buf, sizeof(buf), 0);
    printf("server message :%s\n", buf);

    close(socket_fd); // 关闭socket  
    return 0; // 正常结束  
}

